package lab03.test11;
import java.sql.*;
public class Test11 {
    public static void main(String[] args) {
Connection connection=null;//代表对特定数据库连接
Statement statement=null;//代表一个特定的容器，容纳并执行一条SqL语句
ResultSet resultSet=null;//得到查询结果集
//建立一个jdbc桥接器
        try {
            Class.forName("com.mysql.jdbc.Driver");
            //括号里面是数据源，来源于导入idea的一个包
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
try {
            connection=DriverManager.getConnection("jdbc:mysql://localhost:3306/java_2017?serverTimezone=UTC","root","w19971201t");
            //第一个参数是数据源名称

    statement=connection.createStatement();
    statement.executeUpdate("INSERT INTO t_users(id,usename,password,register_datetime)VALUES (1,'admin','admin',192312312123)");
    statement.executeUpdate("INSERT INTO t_users(id,usename,password,register_datetime)VALUES (2,'chen','12346',123123213123)");
} catch (SQLException e) {
    e.printStackTrace();
}
finally {
    try {
        connection.close();
        statement.close();
    } catch (SQLException e) {
        e.printStackTrace();
    }

}
    }
}
